function unique(arr) {
  let map = new Map()
  let newArr = []
  for (let i = 0; i < arr.length; i++) {
    if (!map.get(arr[i])) {
      map.set(arr[i], true)
      newArr.push(arr[i])
    }
  }
  console.log(newArr);
  return newArr
}

let arr = [1, 1, 'true', 'true', true, true, 15, 15, false, false, undefined, undefined, null, null, NaN, NaN, 'NaN', 0, 0, 'a', 'a', {}, {}];
// unique(arr)


function _unique(arr) {
  let newArr = []
  for (let i = 0; i < arr.length; i++) {
    if (!newArr.includes(arr[i])) {
      newArr.push(arr[i])
    }
  }
  console.log(newArr);
  return newArr
}

_unique(arr)